<%--
  Created by IntelliJ IDEA.
  User: Ken
  Date: 2022/4/29
  Time: 14:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>订单列表页面</title>
    <style>
        *{
            padding: 0px;
            margin: 0px;
        }

        body {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            width: 100%;
            height: 100%;
        }

        table {
            margin: 20px;
        }

        table th{
            padding: 20px;
            background-color: #cccccc;
        }

        table td {
            padding: 20px;
            background-color: #e6e6e6;
        }

    </style>

    <script>
        function goPay(oid){
            window.open("alipayServlet?method=pay&oid=" + oid);
        }
    </script>
</head>
<body>
    <h1>订单列表</h1>
    <table>
        <tr>
            <th>订单号</th>
            <th>金额</th>
            <th>欢乐豆数量</th>
            <th>状态</th>
            <th>操作</th>
        </tr>
        <c:forEach items="${orders}" var="order">
            <tr>
                <td>${order.orderId}</td>
                <td>${order.money}</td>
                <td>${order.happeyBean}</td>
                <td>
                    <!-- 0-未支付 1-已支付 2-申请退款 3-退款中 4-已退款 -->
                    <c:if test="${order.status == 0}">
                        未支付
                    </c:if>
                    <c:if test="${order.status == 1}">
                        已支付
                    </c:if>
                    <c:if test="${order.status == 2}">
                        退款申请中..
                    </c:if>
                    <c:if test="${order.status == 3}">
                        退款中..
                    </c:if>
                    <c:if test="${order.status == 4}">
                        已退款
                    </c:if>
                    <c:if test="${order.status == 5}">
                        已关闭
                    </c:if>
                </td>
                <td>
                    <c:if test="${order.status == 0}">
                        <button onclick="goPay(${order.id});">去支付</button>
                    </c:if>
                    <c:if test="${order.status == 1}">
                        <button>申请退款</button>
                    </c:if>
                    <c:if test="${order.status == 2}">
                        <button>取消申请</button>
                    </c:if>
                </td>
            </tr>
        </c:forEach>
    </table>
    <!-- 导入框架中的分页导航 -->
    <%@include file="page.jsp"%>
</body>
</html>
